//
//  PhoneItem.m
//  Demo0015
//
//  Created by zTercel on 13-1-14.
//  Copyright (c) 2013年 zTercel. All rights reserved.
//

#import "PhoneItem.h"

@implementation PhoneItem
{
    NSMutableString*     _name;
    NSMutableString*     _number;
}

+(id) createWithPhone: (NSString*)name phoneNumber: (NSString*)number
{
    return [[PhoneItem alloc] initWithPhone:name phoneNumber:number];
}

-(id) init
{
    self = [super init];
    if (self)
    {
        _name   = [[NSMutableString alloc] initWithString:@"no name"];
        _number = [[NSMutableString alloc] initWithString:@""];
    }
    return self;
}

-(id) initWithPhone: (NSString*)name phoneNumber: (NSString*)number
{
    self = [self init];
    if (self)
    {
        [self setName: name];
        [self setNumber: number];
    }
    return self;
}

-(void) setName: (NSString*)name
{
    [_name setString: name];
}

-(NSString*) name
{
    return [_name description];
}

-(void) setNumber: (NSString*)number
{
    [_number setString: number];
}

-(NSString*) number
{
    return [_number description];
}

-(void) print
{
    NSLog(@"name: %@   phone number: %@", _name, _number);
}

@end
